﻿//------------------------------------------------------------------
// System Name:    NRemedy
// Component:      NRemedy
// Create by:      Parker Zhou (parkerz@wicresoft.com)
// Create Date:    2012-04-11
//------------------------------------------------------------------
using System;
using System.Linq;

namespace Wicresoft.EKA.NRemedy
{
    public class FormUitl : INameUtil
    {
        public string GetFormNameByModel(object model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            Type type = model.GetType();
            var formAttribute = type.GetCustomAttributes(typeof(ARFormAttribute),false)
                .FirstOrDefault() as ARFormAttribute;
            if (formAttribute == null)
                return null;
            return formAttribute.FormName;
        }
    }
}
